/*
 * @Author: your name
 * @Date: 2021-12-22 16:16:55
 * @LastEditTime: 2021-12-22 20:37:40
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \day11  ts\app\src\store\indexaction.ts
 */

import axios from "axios"
import {Dispatch} from "redux"
// import "../mock/mock"
import {IState} from "../types/index.d"

export let getlist=async(dispatch:Dispatch)=>{
    let res=await axios.get("/api/list")
    dispatch({
        type:"GETLIST",
        list:res.data.list
    })
}

export let addlist=(obj:IState)=>{
    return {
        type:"ADDLIST",
        obj,
    }
}

export let replay_list=(id:string,comment:string)=>{
    return {
        type:"REPLAYLIST",
        id,
        comment
    }
}